#ifndef NEXTSHAPEMANAGER_H
#define NEXTSHAPEMANAGER_H

/*!
 * \file     nextshapemanager.h
 * \brief    Manage creation of shapes and next shape displaying.
 * \author   Duriez Franck
 * \author   Carton Paul-Henri
 * \version  0.1
 */

#include "tetrisexception.h"
#include "shape.h"
#include "drawable.h"

class Shape;

/*!
 * \class  NextShapeManager
 * \brief  Manage Shape creation and next Shape displaying.
 *
 * Manage Shape creation and next Shape displaying.
 *
 * \todo Implement a better position system.
 * \todo Make this class abstract for security : it's friend with Shape.
 */
class NextShapeManager : public Drawable /*{{{*/
{
/*{{{*/
public:
	/*!
	 * \brief Constructor.
	 * \param displayer : where display the new Objects
	 * \param dt        : pointer to the infinitesimal part of time
	 */
	NextShapeManager(QSFMLWidget* displayer, float* dt);

	/*!
	 * \brief Destructor.
	 */
	virtual ~NextShapeManager();

	/*!
	 * \brief Renew m_next_shape and return the old one.
	 */
	Shape* transfertShape();

protected:
	/*!
	 * \brief Create a new Shape and set it in m_next_shape.
	 */
	void createShape() throw(TetrisException::UnexpectedShape);

private:
	Shape* m_next_shape;    ///< Next Shape
	sf::Shape m_background; ///< Background for the next Shape displayer
	Vector2f m_position;    ///< Position (x,y)
/*}}}*/

	/************
	 * DRAWABLE *
	 ************/
/*{{{*/
public:
	void draw() const;
	/*!
	 * \brief Update the Shape NextShapeManager::m_next_shape.
	 *
	 * On update, the Shape is graphically rotated but not
	 * symbolically rotated. So, when the Shape is transfered with
	 * NextShapeManager::transfertShape, we have to put the Squares
	 * of the Shape in the right order.
	 */
	void update();

	/*!
	 * \deprecated Not already implemented
	 * \brief Not implemented.
	 */
	void setCenter(Vector2f center);
	void setPosition(Vector2f position);
	/*!
	 * \deprecated Not already implemented
	 * \brief Not implemented.
	 */
	void setRotation(float angle);

	/*!
	 * \deprecated Not already implemented
	 * \brief Not implemented.
	 */
	void moveCenter(Vector2f dcenter);
	/*!
	 * \deprecated Not already implemented
	 * \brief Not implemented.
	 */
	void move(Vector2f dposition);
	/*!
	 * \deprecated Not already implemented
	 * \brief Not implemented.
	 */
	void rotate(float dangle);

	Vector2f getCenter() const;
	Vector2f getPosition() const;
	float getRotation() const;

	/*!
	 * \deprecated Not already implemented
	 * \brief Not implemented.
	 */
	std::string toString() const;
/*}}}*/
}; /*}}}*/

#endif // NEXTSHAPEMANAGER_H
